package com.fz.song.controller;

import com.fz.song.pojo.SysUser;
import com.fz.song.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Controller
public class UserController {

    @Autowired
    public SysUserService userService;


    @RequestMapping("/user/{id}")
    @ResponseBody
    private SysUser getUser(@PathVariable(value = "id") Integer id) {
        SysUser user = userService.getUser(id);
        return user;
    }


    @RequestMapping("/adduser")
    @ResponseBody
    private Object getUser() {
        List<SysUser> list = new ArrayList<SysUser>();
        for (int i = 0; i < 1000; i++) {
            SysUser user = new SysUser();
            String string = UUID.randomUUID().toString();
            user.setUsername(string);
            user.setPassword("123456");
            user.setSex(1);
            user.setAddress("湖北-襄阳");
            SysUser user1 = userService.InsertUser(user);
            list.add(user1);
        }
        return list;
    }

}
